<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.domain.ZhongLei,java.util.ArrayList,com.domain.*"%>

<%
YongHu yonghu=(YongHu)session.getAttribute("yonghu");

ArrayList<ShangPin> gouwuche=(ArrayList<ShangPin>)session.getAttribute("gouwuche");
ShangPin shangpin;	

ArrayList<DingDan> suoyoudingdan=(ArrayList<DingDan>)session.getAttribute("suoyoudingdan");
DingDan dingdan;

if(yonghu==null)
{
	request.getRequestDispatcher("yonghudenglu.jsp").forward(request, response);
}
if(gouwuche==null || suoyoudingdan==null)
{
	request.getRequestDispatcher("Gerenzhongxin").forward(request, response);
}
%>

<html>
	<head>
		<style>A{text-decoration: NONE} </style>
		<title>个人中心</title>
	</head>
	<body >
	<table width="100%" >
		<tr>
			<td align="left"><a href="shangchengshouye.jsp">商城首页</a></td>
			<td align="right"><a href="Tuichu">退出</a></td>
		</tr>
	</table>

<br>
<font color="#ff0000" size="5">>>>>>>>>>>购物车</font>

	<table align="center" width="100%" bgcolor="#d0eed8">
		<colgroup  width="25%">
		<colgroup  width="15%" span="5">
		<tr>
			<th>图片</th>
			<th>名字</th>
			<th>价格</th>
			<th>数量</th>
			<th>金额</th>
			<th>操作</th>
		</tr>
	</table>
	<br>		
<%
		for(int i=gouwuche.size()-1;i>=0;i--)
		{
			shangpin=gouwuche.get(i);
			if(shangpin.getTupian().size()==0)
			{
%>
				<table bgcolor="#d0eed8" cellspacing="10" >
					<colgroup width="25%">
					<colgroup width="15%" span="5">
					<tr align="center">
						<td>商品已下架</td>
						<td><%=shangpin.getMingzi() %></td>
					
						<td><%=shangpin.getJiage() %></td>
						<td><%=shangpin.getShuliang() %></td>
						<td><%=shangpin.getJiage()*shangpin.getShuliang() %></td>
						<td><a href="Caozuo?caozuoxiaoxi=shanchu&shangpinbianhao=<%=shangpin.getBianhao() %>">删除</a></td>
					</tr>
				</table>	
				<br>
<%					
			}
			else
			{
%>
				<table bgcolor="#d0eed8" cellspacing="10" width="100%">
					<colgroup width="25%">
					<colgroup width="15%" span="5">
					<tr align="center">
						<td rowspan="3"><a href="Shangpinxiangqing?shangpinbianhao=<%=shangpin.getBianhao()%>"><img src="./images/<%=shangpin.getTupian().get(0) %>.jpg" width="100%"></a></td>
						<td rowspan="3"><a href="Shangpinxiangqing?shangpinbianhao=<%=shangpin.getBianhao()%>"><%=shangpin.getMingzi() %></a></td>						
						<td rowspan="3"><%=shangpin.getJiage() %></td>
						<td rowspan="3"><%=shangpin.getShuliang() %></td>
						<td rowspan="3"><%=shangpin.getJiage()*shangpin.getShuliang() %></td>
						<td><a href="Caozuo?caozuoxiaoxi=jian&shangpinbianhao=<%=shangpin.getBianhao() %>"><font size="+3">-</font></a></td>
					</tr>
					<tr align="center"><td><a href="Caozuo?caozuoxiaoxi=jia&shangpinbianhao=<%=shangpin.getBianhao() %>"><font size="+3">+</font></a></td></tr>
					<tr align="center"><td><a href="Caozuo?caozuoxiaoxi=shanchu&shangpinbianhao=<%=shangpin.getBianhao() %>">删除</a></td></tr>	
				</table>	
				<br>
<%					
			}			
		}
%>	
			<div align="center">
				<font size="+3"><a href="jiesuan.jsp">结算</a></font>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<font size="+3"><a href="Caozuo?caozuoxiaoxi=qingkong">清空</a></font>	
			</div>		
			<br><br>

	<font color="#ff0000" size="5">>>>>>>>>>>订单</font>
	<table align="center" width="100%" bgcolor="#d0eed8" >	
		<colgroup width="20%" span="5">
		<tr>
			<th>图片</th>
			<th>名字</th>
			<th>时间</th>
			<th>金额</th>
			<th>操作</th>
		</tr>
	</table>
	<br>
	 
<%
	for(int i=suoyoudingdan.size()-1;i>=0;i--)
	{
%>
		<table align="center" width="100%" bgcolor="#d0eed8" cellspacing="10">	
			<colgroup width="20%" span="5">		
			<tr align="center">
<%
		if(suoyoudingdan.get(i).getTupian()==null)
		{
%>	
				<td>暂无图片</td>		
<%
		}
		else
		{
%>
				<td><img src="./images/<%=suoyoudingdan.get(i).getTupian() %>.jpg"  width="100%" ></td>			
<%
		}
%>
				<td><%=suoyoudingdan.get(i).getMingzi() %></td> 
				<td><%=suoyoudingdan.get(i).getShijian() %></td>
				<td><%=suoyoudingdan.get(i).getZongjia() %></td>
				<td><a href="Dingdanxiangqing?dingdanbianhao=<%=suoyoudingdan.get(i).getBianhao() %>">查看详情</a></td>
			</tr>
		</table>
		<br>
<%	
	}
%>			
  </body>
</html>
